package com.wltt.healing.healinguserweb.handler;

import com.wltt.healing.healinguserservice.service.UserService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

/**
 * @Author: wltt
 * @Date: 2021/9/8 15:26：
 * @Version: 1.0
 * @Description: TODO
 */
@Component
public class UserHandler {

    private static final Logger log = LogManager.getLogger(UserHandler.class);

    @Resource
    private UserService userService;

    /**
     * 登录前获取用于加密密码的秘钥
     *
     * @param serverRequest
     */
    public Mono<ServerResponse> securityKey(ServerRequest serverRequest) {
        return userService.securityKey(serverRequest);
    }

    /**
     * 登录
     *
     * @param serverRequest
     */
    public Mono<ServerResponse> login(ServerRequest serverRequest) {
        return userService.login(serverRequest);
    }

}
